/**
 * 功能描述 列表触发事件
 */
define(function (require, exports, module) {
	var Dialog = require("dialog");
	var aw = require("ajaxwrapper");
	
    module.exports = {
        review : function(data, widget){
        	if(data.isAdjustment){
        		Dialog.alert({
					title : "提示",
					content : "调整后复核请点击调整复核！"
				});
				return false
        	}else if(data.status == "Review" && !data.isAdjustment){
				Dialog.alert({
					title : "提示",
					content : "已经复核完成，无法再次复核！"
				});
				return false
			}else if(data.signUpNumber != data.chargeNumber && !data.isAdjustment){
				Dialog.alert({
					title : "提示",
					content : "收费未完成，无法进行复核！"
				});
				return false
			}else if(data.signUpNumber == data.chargeNumber && !data.isAdjustment){
				Dialog.confirm({
					title : "提示",
					content : "是否确认复核？",
					confirm:function(){
						aw.ajax({
							url : "api/planitemgroup/reviewplanitemgroup",
							data : {
								"pkPlanItemGroup" : data.pkPlanItemGroup
							},
							dataType : "json",
							success : function(datas){
								Dialog.close();
								widget.get("grid").refresh();
							}
						})
					}
				});
			}
        },
        adjustment : function(data, widget){
        	if(data.status == "AdjustmentReview"){
        		Dialog.alert({
					title : "提示",
					content : "已经进行过调整复核！"
				});
				return false
        	}else if(data.signUpNumber == data.chargeNumber && data.isAdjustment){
				Dialog.confirm({
					title : "提示",
					content : "是否确认调整复核？",
					confirm:function(){
						aw.ajax({
							url : "api/planitemgroup/reviewplanitem",
							data : {
								"pkPlanItemGroup" : data.pkPlanItemGroup
							},
							dataType : "json",
							success : function(datas){
								Dialog.close();
								widget.get("grid").refresh();
							}
						})
					}
				});
			}else{
				if(data.isAdjustment){
					Dialog.alert({
						title : "提示",
						content : "调整后收费未完成，无法进行调整复核！"
					});
					return false
				}else{
					Dialog.alert({
						title : "提示",
						content : "没有进行调整，无法进行调整复核！"
					});
					return false
				}
				
			}
        
        }
    };
});
